<?php
	// 方法: echo的中文不会乱码
	header('Content-Type:text/plain;charset=utf-8');
	$GongHao = $_POST['GongHao'];
	$KaoXiangHao = $_POST['KaoXiangHao'];
	$KXMen = $_POST['KXMen'];
	//127.0.0.1
	//172.31.3.21
	$pdo =new pdo("mysql:host=172.31.3.21;port=3306;dbname=tddb;","root","tdled2018");//PDO连接MySQL
	$pdo->query("set character set 'utf8'");//读库
	$pdo->query("set names 'utf8'");//写库
	//姓名的语句
	$sql =
	"SELECT
		 QR
		,Name
	FROM
		person"
	;
	$res=$pdo->prepare($sql);//准备查询语句
	$res->execute(); //执行一条查询语句
	$XM=$res->fetchAll();//取出所有行
	//烤箱参数的语句
	$sql =
	"SELECT
		 GongXu
		,KaoXiangHao
		,HongKaoLeiXing
		,HongKaoTiaoJian
		,FJXX
	FROM
		kaoxiang_tab"
	;
	$res=$pdo->prepare($sql);//准备查询语句
	$res->execute(); //执行一条查询语句
	$KX=$res->fetchAll();//取出所有行
	//待出烤烤箱数据
	$sql =
	"SELECT
		 KXMen
		,GongDanHao
		,PCS
	FROM
		kaoxiang_d AS d
	INNER JOIN
		kaoxiang_h AS h
	ON
		d.KXHID = h.KXHID
	WHERE
		KaoXiangHao = '".$KaoXiangHao."'
	AND
		KXMen = '".$KXMen."'
	AND
		OutGongHao = ''"
	;
	$res=$pdo->prepare($sql);//准备查询语句
	$res->execute(); //执行一条查询语句
	$DCK=$res->fetchAll();//取出所有行
	echo json_encode(array('XM'=>$XM,'KX'=>$KX,'DCK'=>$DCK));//转码成json
?>